package com.ssm.bean;

import java.util.HashMap;
import java.util.Map;

/**
 * Copyright: Copyright (c) 2018/1/4
 * Description:
 * CLASS_NAME: Msg
 * PACKAGE_NAME: com.ssm.bean
 * version: v1.0.0
 * author: Jin Biao
 * date: 2018/1/4 20:38
 */
public class Msg {

    //返回码 1--成功  0-失败
    private String returnCode;

    //返回提示信息
    private String msg;

    //封装返回的数据
    private Map<String,Object> extendMap = new HashMap<String,Object>();

    public static  Msg success(){
        Msg result = new Msg();
        result.setReturnCode("1");
        result.setMsg("处理成功");
        return result;
    }

    public static Msg fail(){
        Msg result = new Msg();
        result.setReturnCode("0");
        result.setMsg("处理失败");
        return result;
    }

    //链式结构
    public Msg add(String key,Object value){
        this.extendMap.put(key,value);
        return this;
    }

    public String getReturnCode() {
        return returnCode;
    }

    public void setReturnCode(String returnCode) {
        this.returnCode = returnCode;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Map<String, Object> getExtendMap() {
        return extendMap;
    }

    public void setExtendMap(Map<String, Object> extendMap) {
        this.extendMap = extendMap;
    }
}
